package com.atqinke.designpattern.structuraltype.adapter.objectadapter;

import com.atqinke.designpattern.structuraltype.adapter.classadapter.SDCard;
import com.atqinke.designpattern.structuraltype.adapter.classadapter.TFCard;

/**
 * @BelongsProject: BasicConnection
 * @BelongsPackage: com.atqinke.DesignPattern.structuraltype.adapter.objectadapter
 * @Author: NieHk
 * @CreateTime: 2022-08-26  16:31
 * @Description: 定义适配器类（SD兼容TF）(符合合成复用原则)
 * @Version: 1.0
 */
public class SDAdapterTF implements SDCard {

    private TFCard tfCard;

    public SDAdapterTF(TFCard tfCard) {
        this.tfCard = tfCard;
    }

    @Override
    public String readSD() {
        System.out.println("adapter read tf card ");
        return tfCard.readTF();
    }
    @Override
    public void writeSD(String msg) {
        System.out.println("adapter write tf card");
        tfCard.writeTF(msg);
    }
}
